<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId" th:object="${people}">
					<div class="select-list">
						<ul>
							<li>
								姓名：<input type="text" name="peopleName"/>
							</li>
							<li class="hide">
								企业信息ID：<input id="companyId" type="text" th:field="*{companyId}"  name="companyId"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			<div class="hide">
				<form id="pc" th:object="${pc}">
					<div class="select-list">
						<input id="pcId" type="text" th:field="*{pcId}"  name="pcId"/>
						<input id="applyStatusOne" th:field="*{applyStatusOne}"  type="text"   name="applyStatusOne"/>
					</div>
				</form>
			</div>
			
	        <div class="btn-group-sm hidden-xs" id="toolbar" role="group">
				<a class="btn btn-success hide" id="addPoeple" onclick="$.operate.add()" shiro:hasPermission="system:people:add">
					<i class="fa fa-plus"></i> 添加
				</a>
				<a class="btn btn-primary btn-edit hide" id="submit" onclick="submitPc()" shiro:hasPermission="system:pc:edit">
					<i class="fa fa-edit"></i> 提交
				</a>
<!--				<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:people:remove">-->
<!--					<i class="fa fa-remove"></i> 删除-->
<!--				</a>-->
<!--				<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:people:export">-->
<!--						<i class="fa fa-download"></i> 导出-->
<!--				 </a>-->
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:people:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:people:remove')}]];
		var peopleOne = [[${@permission.hasPermi('system:peopleOne:view')}]];
        var prefix = ctx + "system/people";
        function submitPc(){
        	var pc_Id= $("#companyId").val();
			$.modal.confirm("确定要提交这一批次员工么，提交后不能修改哦",function(a){
				$.ajax({
					type: "post",
					url:  "/system/pc/edit",
					data: {
						pcId:pc_Id,
						applyStatusOne:'已提交'
					},
					success: function(r) {
						$.modal.msg("审批已提交");
						location.reload();
					}
				});
			})

		}


        $(function() {

			 var pcId = $("#pcId").val();
			 pcId= parseInt(pcId);
            var options = {
                url: prefix + "/list/"+pcId,
                createUrl: prefix + "/add/"+pcId,
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
                modalName: "返岗人员",
				search:false,
				showRefresh:false,
				showColumns:false,
				showToggle:false,
				showSearch:false,
				showExport: true,
				showDropdown:true,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'peopleId', 
					title : '编号',
					visible: false
				},
				{
					field : 'peopleName', 
					title : '姓名',
					sortable: true
				},
				{
					field : 'peopleIdCard', 
					title : '身份证号',
					sortable: true
				},
				{
					field : 'peopleCity', 
					title : '市（州）',
					sortable: true
				},
				{
					field : 'peopleCounty', 
					title : '县（市、区）',
					sortable: true
				},
				{
					field : 'peopleTownship', 
					title : '乡镇（办、场、区',
					sortable: true
				},
				{
					field : 'peopleVillage', 
					title : '社区（村）',
					sortable: true
				},
				{
					field : 'peopleDetailAdress', 
					title : '详细地址',
					sortable: true
				},
				{
					field : 'peopleConnectPhone', 
					title : '手机号',
					sortable: true
				},
				{
					field : 'peopleJob', 
					title : '岗位（工种）',
					sortable: true
				},
				{
					field : 'peopleBackPeople', 
					title : '驾驶人/返岗人员',
					sortable: true
				},
				{
					field : 'peopleCarLicense', 
					title : '车辆牌照号',
					sortable: true
				},
				// {
				// 	field : 'peopleLinkAdress',
				// 	title : '健康证明文件地址',
				// 	sortable: true
				// },
				{
					field : 'peopleFillTime', 
					title : '填报时间',
					sortable: true
				},
				{
					field : 'remark', 
					title : '备注',
					sortable: true
				},{
						title: '操作',
						align: 'center',
						formatter: function(value, row, index) {
							var actions = [];
							var applyStatusOne= $("#applyStatusOne").val();
							if(!applyStatusOne||applyStatusOne=="审核不通过"){
								actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.peopleId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
								actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.peopleId + '\')"><i class="fa fa-remove"></i>删除</a>');
							}
							var a='/system/people/'+row.peopleId;
							actions.push(' <a class="btn btn-success btn-xs ' + peopleOne + '" href="#" onclick="$.operate.showInfo(\'' + a + '\')"><i class="fa fa-search"></i>查看</a> ');
							return actions.join('');
						}
					}
		        ]


            };
			var applyStatusOne= $("#applyStatusOne").val();
			if(!applyStatusOne||applyStatusOne=="审核不通过"){
				$("#submit").removeClass("hide")
				$("#addPoeple").removeClass("hide")

			}else{

			}
            $.table.init(options);
        });
    </script>
</body>
</html>